#include "spellcheck.h"
#include "string_utils.h"

#include <ostream>

using std::string;

namespace NSpellCheck {

Variation::Variation(double weight, const Phrase& phrase):
        weight(weight),
        phrase(phrase)
{}

void parsePhrase(const string& str, Phrase* phrase) {
    split(str, ' ', phrase);
}

} //ns

std::ostream& operator<<(std::ostream& out, const NSpellCheck::Phrase& phrase) {
    for (NSpellCheck::Phrase::const_iterator i = phrase.begin(); i != phrase.end(); ++i) {
        if (i != phrase.begin()) {
            out << " ";
        }
        out << *i;
    }
    return out;
}

std::ostream& operator<<(std::ostream& out, const NSpellCheck::Variation& variation) {
    return out << variation.weight << ":" << variation.phrase;
}
